package com.example.demo.Controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-06-04
 * Time:21:48
 */
@RequestMapping("/user")
@Controller
@ResponseBody // 设置当前类中所有的方法返回的是数据而非页面
public class UserController {
    // 1.得到日志对象
    private static final Logger logger = LoggerFactory.getLogger(UserController.class);

    @RequestMapping("/hi")// 指定路由
    public String sayHi(){
        // 写日志
        logger.trace("我是 trace 痕迹日志");
        logger.debug("我是 debug 日志");
        logger.warn("我是 warn");
        logger.error("我是 error");
        logger.info("我是 info");
        return "Hi,springBoot";
    }
}
